package com.banciyuan.bcywebview.biz.main.newdiscover.index.discoverholder;

import android.content.Context;
import android.text.TextUtils;
import android.view.View;
import android.widget.ImageView;
import android.widget.TextView;

import com.banciyuan.bcywebview.R;
import com.banciyuan.bcywebview.base.helper.push.PushDataHelper;
import com.banciyuan.bcywebview.utils.universalimageloader.core.ImageLoader;
import com.banciyuan.bcywebview.utils.universalimageloader.utils.ImageOptions;

import de.greenrobot.daoexample.model.Timeline;

/**
 * Created by squall on 2017/3/22.
 */

public class EventDiscoverHolder extends BaseDiscoverHolder {

    private ImageView mainPicImg;
    private TextView title;

    public EventDiscoverHolder(View itemView) {
        super(itemView);
        mainPicImg = (ImageView) itemView.findViewById(R.id.iv_main);
        title = (TextView) itemView.findViewById(R.id.tv_special_title);
    }

    @Override
    public void renderData(final Timeline mItem, final Context mContext) {
        super.renderData(mItem, mContext);
        ImageLoader.getInstance().displayImage(mItem.getContentAddress(), mainPicImg, ImageOptions.options);
        if (!TextUtils.isEmpty(mItem.getIntro())) {
            title.setText(mItem.getIntro());
        }
        itemView.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                PushDataHelper.processInnerPushData(mContext, mItem.getCode());
            }
        });
    }

}
